﻿using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HotelManager
{
    public class ImageConverter : IValueConverter
   {
       public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
           BitmapImage bi = new BitmapImage();//create bitmap image
           if (value != null)
           {
               
               MemoryStream ms = new MemoryStream(value as byte[]);
               ms.Seek(0, SeekOrigin.Begin);

               bi.SetSource(ms);
           }
    
             return bi;
          
      }
    
      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
      {
          throw new NotImplementedException("PropertyViewer does not use ConvertBack.");
      }
   }
}
